#pragma  once

namespace MomogenkyouSystem	{

class	TextureData
{
public:
	ALIGN(32)

	TEXTURE			Handle;
	D3DFORMAT		Format;
	size_t			Width;
	size_t			Height;	

	RECT			Rectagle;

	TextureData(TEXTURE pTexture)
	{
		Handle = pTexture;
		D3DSURFACE_DESC	_SurfaceDESC;
		Handle->GetLevelDesc(0, &_SurfaceDESC);
		Format	= _SurfaceDESC.Format;
		Width	= _SurfaceDESC.Width;
		Height	= _SurfaceDESC.Height;

		memset(&Rectagle, 0x00, sizeof(RECT));
		Rectagle.bottom = Height;
		Rectagle.right	= Width;
	}

	__inline	float	AspectRatio()	const	{	return	static_cast<float>(Width) / static_cast<float>(Height);	}
	__inline	float2	WidthHeight()	const	{	return	float2(static_cast<float>(Width), static_cast<float>(Height));	}
};

class	TextureFrame
{
public:
	ALIGN(16)
	float2			m_Coord;
	float2			m_Size;

	TextureFrame()
		:	m_Coord(0, 0), m_Size(0, 0)
	{
	}
};

class ContentManager
{
	//	Contains all textures
	std::map<std::string, TextureData *>	m_Textures;
public:
	ContentManager();
	virtual ~ContentManager();

	//	Remove all contents associated with this ContentManager
	virtual	void					ClearContents();

	//	Flood	the contents with a list of texture filename
	virtual	void					LoadTextures(std::vector<std::string>	Filenames);
	
	//	Load	a single Texture
	virtual	TextureData	*			LoadTexture(std::string	Filenames);

	//	Get TextureData of a given filename, if not found,	returns NULL
	virtual	TextureData	*			GetTexture(const std::string & FileName);

};

}